package com.heima.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.UserLoginDto;
import com.heima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenshan
 */
@RestController
@RequestMapping("api/v1/login")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * APP端用户登录接口
     * {"phone":"13511223456","password":"admin","equipmentId":"88888888"}
     */
    @PostMapping("login_auth")
    public ResponseResult login(@RequestBody UserLoginDto userLoginDto) {
        return userService.loginAuth(userLoginDto);
    }

    /**
     * 查询已登录用户的id
     * @return Integer 用户id
     */
    @GetMapping("selectUserId")
    public Integer selectUserId() {
        return userService.selectUserId();
    }
}
